import requests
from requests.auth import HTTPBasicAuth
import yaml
import json
from os import path
from prettyprinter import cpprint

protocol = "http://"
apigateway = "apis-e112.newegg.org"
itemBizBaseUri = "/api/item/base"
headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063',
    'Accept':'application/json',
    'Content-Type':'application/json',
    'Authorization':'Bearer sS43Jvbg7ofw1C5U487dduM1zdabGuOFmBJxp6ew'
}
proxy = {"ip":'10.16.33.100:9090'}

def read_file(filename):
    file = open(filename).readlines()
    return file

def item_serivice():
    headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
    itemnumber = read_file("PropertyItem.csv")
    url = "http://172.16.140.210:8361/itemservice/specialprice"
    request_body={"CompanyCode": 1003,
                  "CountryCode": "USA",
                  "LanguageCode":"EN-US",
                  "IgnoreCheck":true,
                  "Items":[{"ItemNumber":itemnumber}],
                  "NeedDetailInfo": false,
                  "PriceTypes": [{"PriceType": "0"}],
                  "RequestModel": "productpage"
                  }
    r = requests.post(url=url,data=json.dumps(request_body),headers=headers)